package com.kongyz.shape;

import java.util.HashMap;

/**
 * @author kongyz
 * @date 2018/6/30 11:50
 * @Description:
 */
public class ShapeFactory {

    private static final HashMap<String,Shape> circleMap=new HashMap<String, Shape>();

    public static Shape getCircle(String color){
        Circle circle=(Circle) circleMap.get(color);
        if(circle==null){
            circle=new Circle(color);
            circleMap.put(color,circle);
            System.out.println("创建一个"+color+"的圆形");
        }
        return circle;
    }
}
